package dongshi.daddy.service.enabledubbobinding;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ProtocolConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfig;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfigBinding;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfigBindings;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.PropertySource;

@Configurable
@EnableDubboConfig
// prefix最后带不带"."，效果都是一样的，这里只是为了示意，有的带了，有的没带,另外还可以使用占位符的方式来指定
@EnableDubboConfigBindings({
        // 使用占位符方式来指定
        @EnableDubboConfigBinding(prefix = "${myapplication.placeholder}", type = ApplicationConfig.class),
        // 直接指定，不带"."
        @EnableDubboConfigBinding(prefix = "mydubbo.mymyregistry", type = RegistryConfig.class),
        // 直接指定，带"."
        @EnableDubboConfigBinding(prefix = "mydubbo.myprotocol.", type = ProtocolConfig.class)
})
@DubboComponentScan(basePackageClasses = MyEnableDubboBindingService.class)
@PropertySource("classpath:enabledubbobinding/customExternalConfigInfo.properties")
public class MyEnableDubboConfigBindingConfiguration {
}
